package com.meilingcloud.biobank.domain;

import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import com.meilingcloud.biobank.domain.dto.FormDataSaveDto;
import com.meilingcloud.common.annotation.Excel;
import com.meilingcloud.system.domain.SysAttach;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * 样本源 对象 bank_source
 *
 * @author chenl
 * @date 2021-02-26
 */
@Data
@NoArgsConstructor
@Accessors(chain = true)
@TableName("bank_source")
public class Source implements Serializable {

    private static final long serialVersionUID = 1L;


    /**
     * 样本源ID
     */
    @TableId(value = "source_id", type = IdType.ASSIGN_ID)
    @JsonSerialize(using = ToStringSerializer.class)
    private Long sourceId;

    /**
     * 样本源编号
     */
    @Excel(name = "样本源编号")
    @NotBlank(message = "样本源编号不能为空")
    private String sourceCode;

    /**
     * 样本源类型ID
     */
    @JsonSerialize(using = ToStringSerializer.class)
    @NotNull(message = "样本源类型不能为空")
    private Long sourceTypeId;

    /**
     * 样本源名称
     */
    @Excel(name = "样本源名称")
    @NotBlank(message = "样本源名称不能为空")
    private String sourceName;

    /**
     * 样本源描述
     */
    @Excel(name = "样本源描述")
    private String sourceDesc;

    /**
     * 随访状态
     */
    @Excel(name = "随访状态", prompt = "0: 无需随访, 1: 待随访")
    private String followState;

    /**
     * 是否就诊提醒 0-否  1-是
     */
    @Excel(name = "是否就诊提醒", prompt = "0: 否, 1: 是")
    private String visitReminder;

    /**
     * 是否就诊提醒 0-否  1-是
     */
    @Excel(name = "是否就诊提醒", prompt = "0: 否, 1: 是")
    private String idCard;

    /**
     * 自定义表单key
     */
    @Excel(name = "自定义表单key", type = Excel.Type.EXPORT)
    private String formKey;

    /**
     * 表单属性定义
     */
    @Excel(name = "表单属性定义", type = Excel.Type.EXPORT)
    private String formDesc;

    /**
     * 表单值
     */
    @Excel(name = "表单值", type = Excel.Type.EXPORT)
    private String formData;

    /**
     * 删除标志
     */
    @TableLogic(value = "0", delval = "1")
    private String delFlag;

    /**
     * 创建者
     */
    private String createBy;

    /**
     * 创建时间
     */
    @TableField(value = "create_time", fill = FieldFill.INSERT)
    private Date createTime;

    /**
     * 更新者
     */
    private String updateBy;

    /**
     * 更新时间
     */
    @TableField(value = "update_time", fill = FieldFill.UPDATE)
    private Date updateTime;

    @TableField(exist = false)
    @Excel(name = "样本源类型编码")
    private String sourceTypeCode;

    @TableField(exist = false)
    @Excel(name = "样本源类型", type = Excel.Type.EXPORT)
    private String sourceTypeName;

    @TableField(exist = false)
    private FormDataSaveDto formDataSaveDto;

    /**
     * 附件
     */
    @TableField(exist = false)
    private List<SysAttach> attaches;

    @TableField(exist = false)
    private Map<String, Object> params = new HashMap<>();
}
